Create an object

To create a new object, you can use the constructor, which has all not-null fields as parameters.


Employee employee = new Employee("Duck", "Donald");


Then you can set further members:


employee.Birthdate = new DateTime(1934, 6, 9);

employee.Title = "Mister";


Then you can call the method Persist of the Employee class.


employee.Persist();


Now a new object is created in the database. Notice that the member Employeeid has the new generated auto primary key value.